A filtering mechanism is typically used to narrow the scope of data that is presented to an application or to a user, depending on database structure and the needs of a company. Sometimes it makes sense for the company to organize its database into a tree structure, but trees can be difficult to filter because a tree structure has many layers. Additionally, some filtering schemes have access only to certain levels of tree structures, thereby making it difficult to further filter data that is organized as a tree structure. Furthermore, limited level access may not allow delivery of multi-level data required by some applications.
There are methods that attempt to overcome data filtering limitations, including mySQL databases with native recursive queries and traversals, custom nodes, database triggers, and ArrayCollection. The use of database triggers is common, where the database itself provides a mechanism for an application to specify that it wants some code to be executed when one or more fields are updated in the database. The database triggers work for some enterprises, but the method can be very slow and inefficient. It is also common to use an ArrayCollection as a data provider for tree data. There are functions that loop through each node and its children recursively. A node or its children must match a certain criterion or set of criteria, but this method has speed and efficiency issues as well. As mentioned previously, filters may be too limited to get to the levels of a tree needed by an application. Custom nodes can present special challenges as data smoothness can be problematic. An ArrayCollection is limited in that it only works on the first level of objects unless there is built-in recursion. Recursion is a grossly inefficient option as it requires going into every child and setting the filterFunction on each ArrayCollection of each child.